<!DOCTYPE html>
<html lang="en" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<link rel="stylesheet" th:href="@{/assets/css/colorbox.css}" />
<head th:include="fragments/head::header" />
<style>
    .error {
        color: #F00
    }
</style>
<body>
<div th:include="fragments/top::top"></div>
<div class="main-container" id="main-container">
    <div class="main-container-inner">
        <div th:include="fragments/left::left" class="sidebar" id="sidebar"></div>
        <div class="main-content">
            <div class="breadcrumbs" id="breadcrumbs">
                <ul class="breadcrumb">
                    <li>学生列表</li>
                    <li>签证申请列表</li>
                </ul>
            </div>
            <div class="page-content">
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <div class="row">
                            <div class="col-xs-12">
                                <div th:include="fragments/student_info::student_info" th:style="${session.studentInfoKey == null}? 'display:none'"></div>
                                <h3 class="header smaller lighter blue">签证申请列表</h3>
                                <input id="oaid" th:value="${session.user.oaid}" type="text" name="oaid" style="display: none"/>

                                <input type="hidden" name="fromChannel" id="fromChannel" th:value="${#httpServletRequest.getParameter('fromChannel')}"/>
                                <input id="input_canEdit" th:value="${canEdit}" type="hidden" />
                                <input id="input_canAddVisaApply" th:value="${canAddVisaApply}" type="hidden" />
                                <input id="input_hasVisaRecord" th:value="${has_visaRecord}" type="hidden" />
                                <input type="text" id="input_nationStatus" th:value="${nationStatus}" style="display: none"/>
                                <div class="table-header" style="height:42px">
                                    <form class="form-inline">
                                        <div class="form-group">
                                        </div>
                                        <shiro:hasPermission name="visaApply:add">
                                            <a id="a_visaAdd" data-toggle="modal" class="btn btn-info pull-right" href="javascript:void(0);" >添加签证申请</a>
                                        </shiro:hasPermission>
                                        <shiro:hasPermission name="visaRecord:add">
                                            <a id="a_record" data-toggle="modal" class="btn btn-info pull-right" href="javascript:void(0);" >获签或入读信息</a>
                                        </shiro:hasPermission>
                                        <shiro:hasAnyRoles name="同业经理,机构">
                                            <a id="a_record_detail" data-toggle="modal" class="btn btn-info pull-right"  href="javascript:void(0);" >获签或入读信息查看</a>
                                        </shiro:hasAnyRoles>
                                        <a id="a_studentUrl" data-toggle="modal" data-target="#myModal" href="javascript:void(0);" class="btn btn-info pull-right">学生列表</a>

                                        <shiro:hasPermission name="visaApply:edit">
                                            <input type="hidden" id="input_hasPermission_visaApply_edit" value = "1"/>
                                        </shiro:hasPermission>
                                        <shiro:hasPermission name="visaResult:edit">
                                            <input type="hidden" id="input_hasPermission_visaResult_edit" value = "1"/>
                                        </shiro:hasPermission>
                                        <shiro:hasPermission name="visaApply:detail">
                                            <input type="hidden" id="input_hasPermission_visaApply_detail" value = "1"/>
                                        </shiro:hasPermission>

                                        <shiro:hasPermission name="visaApply:delete">
                                            <input type="hidden" id="input_hasPermission_visaApply_delete" value = "1"/>
                                        </shiro:hasPermission>
                                        <shiro:hasPermission name="visaResult:delete">
                                            <input type="hidden" id="input_hasPermission_visaResult_delete" value = "1"/>
                                        </shiro:hasPermission>
                                        <shiro:hasPermission name="院校申请列表_查看">
                                            <input type="hidden" name="checkPermission" id="checkPermission" th:value="true"/>
                                        </shiro:hasPermission>
                                    </form>
                                </div>
                                <div class="table-responsive">
                                    <div id="alert" class="alert alert-success" style="display: none;" role="alert">
                                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                            <span aria-hidden="true">&times;</span>
                                        </button>
                                        <span id="alertText"></span>
                                    </div>
                                    <table id="sample-table-2" class="table table-striped table-bordered table-hover">
                                        <thead>
                                        <tr>
                                            <th class="hide">id</th>
                                            <th>内网学号</th>
                                            <th>签证方式</th>
                                            <th>签证类型</th>
                                            <th>送件日期</th>
                                            <th>备注</th>
                                            <th>操作人</th>
                                            <th>操作时间</th>
                                            <th>签证申请审核状态</th>
                                            <th class="hidden-480" >操作</th>
                                        </tr>
                                        </thead>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div th:include="fragments/bottom::bottom"></div>
    </div>
    <a href="#" id="btn-scroll-up"
       class="btn-scroll-up btn btn-sm btn-inverse"> <i
            class="icon-double-angle-up icon-only bigger-110"></i>
    </a>
</div>
<!-- Modal备注 -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content"></div>
    </div>
</div>
<div th:include="fragments/js::js"></div>
<script th:src="@{/assets/js/jquery.validate.min.js}"></script>
<script th:src="@{/assets/js/jquery.validate.zh-CN.js}"></script>
<!-- page specific plugin scripts -->
<script th:src="@{/assets/js/jquery.dataTables.min.js}"></script>
<script th:src="@{/assets/js/jquery.dataTables.bootstrap.js}"></script>
<script th:src="@{/assets/js/temp.js}" charset="UTF-8"></script>
<script th:src="@{/assets/js/date-time/moment.min.js}"></script>
<script th:src="@{/business/common.js}"></script>
<!--图片查看器-->
<script th:src="@{/assets/js/jquery.colorbox-min.js}"></script>
<script th:src="@{/layer/layer.js}"></script>
<script type="text/javascript">
    <!--
    jQuery(function($) {
        var pageHelper = (function(){
            this.studentNo;
            this.oTable1;
            this.canAddVisaApply;
            this.toDetail = function(id,studentNo){
                window.open("/visaApply/detailPage?id=" + id+"&studentNo="+studentNo,target="_self");
            }
            this.toEditURL = function(id,studentNo){
                window.open("/visaApply/editPage?id=" + id+"&studentNo="+studentNo,target="_self");
            }
            return{
                init:function(){
                    this.getQueryData();
                    this.handelQueryData();
                    this.render();
                    this.addEvent();

                },
                getQueryData:function(){
                    this.studentNo = GetQueryString("studentNo");
                    this.canAddVisaApply = $("#input_canAddVisaApply").val();
                    this.nationStatus = $("#input_nationStatus").val();
                },
                handelQueryData:function(){

                },
                render:function(){
                    var _self = this;
                    if(_self.canAddVisaApply != "true"){
                        $("#a_visaAdd").hide();
                    }
                    _self.oTable1 = $('#sample-table-2').dataTable({
                        "bFilter" : false,//是否使用搜索
                        "bProcessing" : true,
                        "bDeferRender" : true,//
                        "sPaginationType" : "bs_normal",//分页样式
                        "bRetrieve" : true,//是否调用后台
                        "bServerSide" : true,//是否以后台分页
                        "sAjaxSource" : "/visaApply/list/query",//请求路径
                        "fnServerData" : function(sSource, aoData, fnCallback) {
                            aoData.push(
                                {
                                    "name":"studentNo",
                                    "value":_self.studentNo
                                }
                            )
                            $.ajax({
                                "dataType" : 'json',
                                "type" : "GET",
                                "url" : sSource,
                                "data" : aoData,
                                "success" : fnCallback
                            });
                        },
                        "aaSorting" : [ [ 1, "desc" ] ],
                        "aoColumns" : [
                            {"sClass": "center", "bVisible": false, "mData": "id"},
                            {"sClass": "center", "bVisible": false, "mData": "studentNo"},
                            {"sClass": "center", "bSortable": false, "mData": "visaWay_string"},
                            {"sClass": "center", "bSortable": false, "mData": "visaType_string"},
                            {"sClass": "center", "bSortable": false, "mData": "sendDate",
                                "mRender" : function(data, type, full, meta) {
                                    if (data != null) {
                                        return moment(data).format("YYYY-MM-DD");
                                    } else {
                                        return "";
                                    }
                                }
                            },
                            {"sClass": "center", "bSortable": false, "mData": "visaComment"},
                            {"sClass": "center", "bSortable": false, "mData": "operatorName"},
                            {"sClass": "center", "bSortable": false, "mData": "createTime",
                                "mRender" : function(data, type, full, meta) {
                                    if(data != null){
                                        return  moment(data).format("YYYY-MM-DD");
                                    }
                                    else
                                        return "";
                                }
                            },
                            {"sClass": "center", "bVisible": false, "mData": "applyAuditStatus"},
                            {"sClass" : "center", "bSortable" : false, "mData" : function (data) {
                                var styleDiv='<div class="visible-md visible-lg hidden-sm hidden-xs action-buttons">';
                                var check = '';
                                if($("#input_hasPermission_visaApply_detail").val() == "1"){
                                    check ="<a class='blue' href='javascript:void(0);' onclick='toDetail(" + data.id + ",\""+_self.studentNo+"\")'><i class='icon-zoom-in bigger-130'></i></a>";
                                }
                                var editOperation = '';
                                if($("#input_hasPermission_visaApply_edit").val() == "1" && $("#input_hasPermission_visaResult_edit").val() == "1") {
                                    if($("#input_canEdit").val() == "true" || data.operatorNo == $("#oaid").val())  {
                                        editOperation = "<a class='green' href='javascript:void(0);' onclick='toEditURL(" + data.id + ",\""+_self.studentNo+"\")'><i class='icon-pencil bigger-130'></i></a>";
                                    }
                                }
                                var deleteOperation = '';
                                if($("#input_hasPermission_visaApply_delete").val() == "1" && $("#input_hasPermission_visaResult_delete").val() == "1") {
                                    deleteOperation = "<a class='red' href='javascript:void(0);' onclick='toDetail(" + data.id + ",\""+_self.studentNo+"\")'><i class='icon-trash icon-2x icon-only bigger-130'></i></a>";
                                }
                                return styleDiv+check+editOperation+deleteOperation;
                            }}
                        ],
                        "oLanguage" : {
                            "sLengthMenu" : "每页 _MENU_条 ",
                            "sZeroRecords" : "对不起，查询不到任何相关数据",
                            "sInfo" : "当前显示 _START_ 到 _END_ 条，共 _TOTAL_ 条记录 ",
                            "sInfoEmpty" : "显示 0 到 0 条，共 0 条记录",
                            "sInfoFiltered" : "数据表中共为 _MAX_ 条记录)",
                            "sProcessing" : "正在加载中...",
                            "sSearch" : "搜索",
                            "sUrl" : "", //多语言配置文件，可将oLanguage的设置放在一个txt文件中，例：Javascript/datatable/dtCH.txt
                            "oPaginate" : {
                                "sFirst" : "第一页",
                                "sPrevious" : " 上一页 ",
                                "sNext" : " 下一页 ",
                                "sLast" : " 最后一页 "
                            }
                        }
                        //多语言配置
                    });
                },
                addEvent:function(){
                    var _self = this;
                    $("#a_visaAdd").click(function () {
                        if ($("#input_nationStatus").val() == "1" || $("#input_nationStatus").val() == "2" || $("#input_nationStatus").val() == "3") {
                            layer.open({
                                title: '选择国家',
                                type: 2,
                                area: ['450px', '238px'],
                                fixed: false, //不固定
                                content: "/visaApply/chooseCountry?studentNo=" + _self.studentNo+ "&type=visaApply",
                            });
                        }else{
                            window.open("/visaApply/addPage?studentNo="+_self.studentNo,target="_self");
                        }
                    });
                    $("#a_record").click(function(){
                        if($("#input_hasVisaRecord").val() == "0"){
                            if ($("#input_nationStatus").val() == "1" || $("#input_nationStatus").val() == "2" || $("#input_nationStatus").val() == "3") {
                                layer.open({
                                    title: '选择国家',
                                    type: 2,
                                    area: ['450px', '238px'],
                                    fixed: false, //不固定
                                    content: "/visaApply/chooseCountry?studentNo=" + _self.studentNo + "&type=visaRecord",
                                });
                            }else{
                                window.open("/visaRecord/addPage?studentNo=" + _self.studentNo, target = "_self");
                            }
                        }else{
                            window.open("/visaRecord/addPage?studentNo=" + _self.studentNo, target = "_self");
                        }

                    });
                    $("#a_record_detail").click(function(){
                        if($("#input_hasVisaRecord").val() != "1"){
                            layer.alert('此学生暂无获签信息数据！', {icon: 0});
                            return;
                        }
                        window.open("/visaRecord/detailPage?studentNo=" + _self.studentNo, target = "_self");
                    });
                    $("#a_studentUrl").click(function(){
                        location.href="/studentInfo";
                    });
                    $("#query").click(function() {
                        _self.oTable1.fnDraw();
                    });
                }
            }
        })();
        pageHelper.init();
    });

    $(function(){
        if($("#checkPermission").val() == "true" && $("#fromChannel").val() == "1" ){
            $("#a_visaAdd").hide();
            $("#a_record").hide();
            $("#a_studentUrl").hide();
        }
    });
    -->
</script>
</body>
</html>